import pygame,sys,os

class Many_Spike(pygame.sprite.Sprite):
    def __init__(self,tl_x,tl_y):
        super().__init__()
        self.image = pygame.image.load(self.resource_path("source/img/spikes.png"))
        self.rect = self.image.get_rect()
        self.rect.topleft = (tl_x,tl_y)
    def many_spike_person(self,person):
        if pygame.sprite.collide_rect(self,person):
            person.alive = False
    def resource_path(self,relative_path):
        """ 根据打包后的环境动态加载资源路径 """
        if hasattr(sys, '_MEIPASS'):
            base_path = sys._MEIPASS
        else:
            base_path = os.path.abspath(".")
        return os.path.join(base_path, relative_path)

